<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0 auto;
            padding: 0;
        }
        .box{
            border: 2px solid black;
            width: 200px;
            height: 200px;
            transition: all 2s;
            background-color: red;
        }
        .colorRed{

            transform: rotate(5);
            background-color: red;
        }
        .colorYellow{
            transform: rotate(360);

            background-color: yellow;
        }
        
    </style>
</head>
<body>
    <script src="./js/jquery.min.js"></script>

    <div class="box">
        
    </div>

<script>
    $(function(){
       
        $('div').mouseover(function() {
            // if ( !$(this).hasClass('colorRed'))
            //     $(this).addClass('colorRed');
            // else
            //     $(this).addClass('colorYellow');
                $(this).toggleClass('colorYellow');
            

        })
        
    })
</script>
</body>
</html>